package phenix.com.phenixdemo.model;

import android.app.Activity;
import android.app.Service;
import android.content.Context;

import org.androidannotations.annotations.EBean;
import org.androidannotations.annotations.RootContext;

import phenix.com.phenixlib.util.Logger;

/**
 * Created by zhouphenix on 2016-4-13.
 */
@EBean//注意：这个类必须仅仅只能有一个构造函数，参数最多有一个context。
public class ClassTestAA{
    @RootContext
    Context context;

    // Only injected if the root context is an activity
    @RootContext
    Activity activity;

    // Only injected if the root context is a service
    @RootContext
    Service service;

    String name = "普通类测试";

    public ClassTestAA() {
        //--结果  true-true-true  构造方法之后注入
        Logger.i(name+"-"+(context == null)+"-"+(activity == null)+"-"+(service == null));
    }
    public void println(){
        //==================不打印，why?
        Logger.v(name+"-"+(context == null)+"-"+(activity == null)+"-"+(service == null)+"\n");
        Logger.d(name+"-"+(context == null)+"-"+(activity == null)+"-"+(service == null)+"\n");
        //==================会打印  --结果  false-false-true 其中service为null是没有指定具体Service
        Logger.i(name+"-"+(context == null)+"-"+(activity == null)+"-"+(service == null)+"\n");
        Logger.w(name+"-"+(context == null)+"-"+(activity == null)+"-"+(service == null)+"\n");
        Logger.e(name+"-"+(context == null)+"-"+(activity == null)+"-"+(service == null)+"\n");
    }
}